UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lPS7+W7beADCWwKqP2WZ9Wp2ll93T7EyyLyF3TQL5t0='
WHERE
key_id = 'a99d6109212d8318051a03c9c2a78ef1c49c6a5a3c35dd940867387096c23a93'
AND (
token = 'lPS7+W7beADCWwKqP2WZ9Wp2ll93T7EyyLyF3TQL5t0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)