UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wL74ZK8scvrB2u/iaxuSPbqs7HJGiGYYLS6rdH54D/c=' 
WHERE 
  key_id = 'b09c3b43bea7110bb66041889dad078b832966e16645dbcafdad97a3af0064b8' 
  AND (
    token = 'wL74ZK8scvrB2u/iaxuSPbqs7HJGiGYYLS6rdH54D/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038