UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MICgwe93X3XnFStCQS8L1SOjviBKfUpIR5ya6ZBb9ug=' 
WHERE 
  key_id = '182af445fbc4e1842627a215dc67e075e5f889f794a37678d99c2e033b4d4b25' 
  AND (
    token = 'MICgwe93X3XnFStCQS8L1SOjviBKfUpIR5ya6ZBb9ug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051