UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D2W3zRUEPhKKV47HFJ0u51bKeHWwuO7cD7GvOV8dhgc='
WHERE
key_id = '17e4755e9521f2d8842896139b4c56ce245bd7abfbe6922bfe665c6cedaede1c'
AND (
token = 'D2W3zRUEPhKKV47HFJ0u51bKeHWwuO7cD7GvOV8dhgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)