UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uBSCXVdmwNV59LWfVz7RDCaTqG87HTfEXhIsN9mIHd0='
WHERE
key_id = '1395d8aec6a42ca7e3c3ce3bde290da02d18673e4c89971a64ff80e0672f1168'
AND (
token = 'uBSCXVdmwNV59LWfVz7RDCaTqG87HTfEXhIsN9mIHd0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)