UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/dnE0AIvxaY0v3A2pOpIak9PEMhpWSnZJQbIFULTQYM='
WHERE
key_id = '31c10b2550f7eef9c6335946a2e1012718c4f3688ebb3c314735711b44d54339'
AND (
token = '/dnE0AIvxaY0v3A2pOpIak9PEMhpWSnZJQbIFULTQYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)