UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jw3aG4j2s9KRH5Bzq6yDveuc+NYrO0E4n7kwSXyTBzo=' 
WHERE 
  key_id = '27c59344968441b08f708b0010b6284e7e1a437e560a2a12e4389f4f0556bf41' 
  AND (
    token = 'Jw3aG4j2s9KRH5Bzq6yDveuc+NYrO0E4n7kwSXyTBzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056