UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0AyOoUxK5Q1xC8S55qiAXF3islflItMZxIo/b9oL6WI='
WHERE
key_id = 'afd06f8a4b02820045cc71867b0b41a67cf4b987357eaad5368fc36e0f949fc1'
AND (
token = '0AyOoUxK5Q1xC8S55qiAXF3islflItMZxIo/b9oL6WI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)