UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y38cWRv3+SRafxeOui8dP7Q8cLNmfz267xKpmLYuIYQ='
WHERE
key_id = '1034edaba1a6cf45c219c3a593469e021a29556b117cf208e92b136e3c070bc3'
AND (
token = 'Y38cWRv3+SRafxeOui8dP7Q8cLNmfz267xKpmLYuIYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)