UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qbshAVPxzWHQl2R+pLfDzM/jQ3JCoZtBbiI8I7nOTEU='
WHERE
key_id = 'a1dd058d34be556c49c1a7192f33cc5150af1731b2ef1756d8a9b6a0b97e91bc'
AND (
token = 'qbshAVPxzWHQl2R+pLfDzM/jQ3JCoZtBbiI8I7nOTEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)