UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VTmtzdQbEe7/l3ugjLC+Wt3pD+sJZKH0aqDEH10PSo0=' 
WHERE 
  key_id = '595b1a736a8c3048d3c1065380c3615e344e28bf7eba75c55da41c365d3c892d' 
  AND (
    token = 'VTmtzdQbEe7/l3ugjLC+Wt3pD+sJZKH0aqDEH10PSo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017