UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5r0eUUwb9OhjfSr1N0Yzg+cKqkigWeXZs41knZk5RIs='
WHERE
key_id = '7bc8bef9ef789dddab9d0df04a652527a47d401d95ff5d4c6319b7c6198d6312'
AND (
token = '5r0eUUwb9OhjfSr1N0Yzg+cKqkigWeXZs41knZk5RIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)