UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p1iUNKfmHKk1u08u+P29mo1eamgup6xjQN2E+4LdKRc='
WHERE
key_id = '40beda72dffe14e3fe5b89bb7d5ef8c3887ecac0b5e175ddc2b1f6d95a2370c3'
AND (
token = 'p1iUNKfmHKk1u08u+P29mo1eamgup6xjQN2E+4LdKRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)