UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qa+MDp+216xY6QAc6RAx0fHz4PP+PFHRGGcEVJejlIk=' 
WHERE 
  key_id = '468accb430f0ae27830fc88e75b255c9f08e4d43edbbc88c96e8f2243726cb01' 
  AND (
    token = 'qa+MDp+216xY6QAc6RAx0fHz4PP+PFHRGGcEVJejlIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024