UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LqSQssMhV24klLhOXYf/Y714i+uUUlcTHkU8cKjAf08=' 
WHERE 
  key_id = '456ddabb45a9b5b3c399e21f1882fba8e14b9ea3d24996519dc06702c89621d2' 
  AND (
    token = 'LqSQssMhV24klLhOXYf/Y714i+uUUlcTHkU8cKjAf08=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023