UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cL3QoDjWw8EMOcJgsGPWWE69uSylEB/SOcbS6rn9gD0='
WHERE
key_id = '058c5602da97f9096378eeab62fd8e418a6e4246c58a971c6954eab44cddd360'
AND (
token = 'cL3QoDjWw8EMOcJgsGPWWE69uSylEB/SOcbS6rn9gD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)