UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2wM0ta35udIwNupn06CIMu13oB8hELOeXqajHeG+a48=' 
WHERE 
  key_id = '745a56526b1be6cc429655857d6b3eb9c3a4c95668212f240bd36c5bc6787c83' 
  AND (
    token = '2wM0ta35udIwNupn06CIMu13oB8hELOeXqajHeG+a48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045