UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a+eGa3l7FdJ1mWughRETcrLr+XjOwcf2xks+TS0SfAo='
WHERE
key_id = 'f5a40f1ebe4b1b35cc9028729405f31bc5e3d5eaca6ced76c8779635aa218bbe'
AND (
token = 'a+eGa3l7FdJ1mWughRETcrLr+XjOwcf2xks+TS0SfAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)