UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aYH1uYPa6Fc2okKBr5fENZ3avdWgAgdSSsBZC4CH0Ao=' 
WHERE 
  key_id = 'aad142b4213817b5b081bed97f17d7cc47df571c21d8086bc296c69e526ba4f5' 
  AND (
    token = 'aYH1uYPa6Fc2okKBr5fENZ3avdWgAgdSSsBZC4CH0Ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045