UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TywYfoRdvzvz3iMtMieNSZnt/n8RUHpSQvSCNuqsybw=' 
WHERE 
  key_id = '8397850fe8184c610324ba4d02fcfd017de85455ba1bdda6e81627bea7ee9be1' 
  AND (
    token = 'TywYfoRdvzvz3iMtMieNSZnt/n8RUHpSQvSCNuqsybw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035