UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j9G7w30a1p8r86478IjhCiKAJWAenAcePAavD83xNtE=' 
WHERE 
  key_id = '8719e833247a20d0a3d62b1c0a330743a71ab686fdd7d7f9c23a7956ae9d5b5e' 
  AND (
    token = 'j9G7w30a1p8r86478IjhCiKAJWAenAcePAavD83xNtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045