UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BakjVmyKZ1Fz5q38oxolvYQ7FD2hFqPtbKXlP3+DyWw='
WHERE
key_id = 'efa57f888393c9d98b145912a751ea3fb76820a1a8f7e3d023ca85542acb10ab'
AND (
token = 'BakjVmyKZ1Fz5q38oxolvYQ7FD2hFqPtbKXlP3+DyWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)