UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bAA+CFQnOlR/9/OoaYsQgXiAI+DBRpVx2UU6MPpfJRs=' 
WHERE 
  key_id = 'a80d218bc627035c0189edd9bea87ebee8d0a9cdc272668230f9eb19104f495e' 
  AND (
    token = 'bAA+CFQnOlR/9/OoaYsQgXiAI+DBRpVx2UU6MPpfJRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034