UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/JgRd/Mf+sYpIyWNJZNJ+5Jcd7sTYt0UidZd+He4al0=' 
WHERE 
  key_id = '7496d556802ea5c9c9c43fe439fa7911d0d764c7803b61f73f870d87bab000c1' 
  AND (
    token = '/JgRd/Mf+sYpIyWNJZNJ+5Jcd7sTYt0UidZd+He4al0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030